package com.imoocdl.converter;

import com.imoocdl.dataobject.OrderMaster;
import com.imoocdl.dto.OrderDtDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by pc on 2018/3/31.
 */
public class OrderMaster2OrderDTOConverter {

    public static OrderDtDTO convert(OrderMaster orderMaster){
        OrderDtDTO orderDtDTO = new OrderDtDTO();
        BeanUtils.copyProperties(orderMaster,orderDtDTO);
        return orderDtDTO;
    }
    public static List<OrderDtDTO> convert(List<OrderMaster> orderMasterList){
        return orderMasterList.stream().map( e -> convert(e)).collect(Collectors.toList());
    }
}
